package com.studyyoun.android.androidcommonbaselibrary.utils;

import com.google.gson.Gson;

/**
 * Created by androidlongs on 17/3/1.
 * 站在顶峰，看世界
 * 落在谷底，思人生
 */

public class GsonUtil {
    private static Gson gson = new Gson();

    // 将Json数据解析成相应的映射对象
    public static <T> T parseJsonWithGson (String jsonData, Class<T> type) {

        T result = gson.fromJson(jsonData, type);
        return result;
    }

    public static <T> String toJson (T t) {
        return gson.toJson(t);
    }


}
